!function(){var t={703:function(t,e,o){"use strict";var n=o(414);function r(){}function a(){}a.resetWarningCache=r,t.exports=function(){function t(t,e,o,r,a,i){if(i!==n){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var o={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:a,resetWarningCache:r};return o.PropTypes=o,o}},697:function(t,e,o){t.exports=o(703)()},414:function(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},e={};function o(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,o),a.exports}o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";var t=window.wp.element,e=window.wp.apiFetch,n=o.n(e);async function r(t,e,o){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;try{const r=await t();return!!r&&(r.status===n?e(r):o(r))}catch(t){}}async function a(t){try{return await n()(t)}catch(t){return t.error&&t.status?t:t instanceof window.Response&&await t.json()}}const i=async()=>await r((async()=>await(async()=>await a({path:"wordproof/v1/oauth/destroy",method:"POST"}))()),(t=>t),(()=>!1)),{get:s}=lodash,c=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(window,"wordproofSdk.data"+(t?`.${t}`:""),e)};function d(t){const e=new window.CustomEvent(t);window.dispatchEvent(e)}function p(){d("wordproof:open_authentication")}const{dispatch:u}=wp.data;var w=o(697),f=o.n(w);const{__:__}=wp.i18n,{useCallback:l}=wp.element,{withSelect:h}=wp.data,{compose:y}=wp.compose,g=e=>{const{isAuthenticated:o}=e,n=c("popup_redirect_authentication_url"),r=c("popup_redirect_settings_url"),a=l((t=>{t.preventDefault(),d("wordproof:open_settings")})),i=l((t=>{t.preventDefault(),p()}));return(0,t.createElement)(t.Fragment,null,o&&(0,t.createElement)("a",{href:r,onClick:a},__("Open settings","wordproof")),!o&&(0,t.createElement)("a",{href:n,onClick:i},__("Open authentication","wordproof")))};g.proptypes={isAuthenticated:f().bool.isRequired};var _=y([h((t=>({isAuthenticated:t("wordproof").getIsAuthenticated()})))])(g);const{render:v}=wp.element,{select:b,subscribe:m}=wp.data;(function(){const{setIsAuthenticated:t,setSelectedPostTypes:e}=u("wordproof"),o=c("popup_redirect_authentication_url"),n=c("popup_redirect_settings_url");let s=null;const p=(t,e)=>{s=function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:800,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:680;const a=t.top.outerHeight/2+t.top.screenY-r/2,i=t.top.outerWidth/2+t.top.screenX-n/2;return t.open(e,o,`toolbar=no,\n\t\tlocation=no,\n\t\tdirectories=no,\n\t\tstatus=no,\n\t\tmenubar=no,\n\t\tresizable=no,\n\t\tcopyhistory=no,\n\t\twidth=${n},\n\t\theight=${r},\n\t\ttop=${a},\n\t\tleft=${i}`)}(window,t,e),s&&s.focus(),window.addEventListener("message",w,!1)},w=async t=>{const{data:e,source:o,origin:n}=t;if(n===c("origin")&&s===o)switch(e.type){case"wordproof:oauth:granted":!1===await h(e)&&await f("wordproof:oauth:failed",!1);break;case"wordproof:oauth:failed":await f("wordproof:oauth:failed",!1);break;case"wordproof:oauth:denied":await f("wordproof:oauth:denied",!1);break;case"wordproof:oauth:invalid_token":await f("wordproof:oauth:invalid_token",!1);break;case"wordproof:webhook:success":await f("wordproof:oauth:success",!0);break;case"wordproof:webhook:failed":await f("wordproof:webhook:failed",!1);break;case"wordproof:settings:updated":await f("wordproof:settings:updated"),await y(e);break;case"wordproof:oauth:destroy":await f("wordproof:oauth:destroy",!1);break;case"wordproof:oauth:retry":await f("wordproof:open_authentication",!1);break;case"wordproof:oauth:close":l()}},f=async function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;l(),d(e),!1===o&&(await i(),t(!1)),!0===o&&t(!0)},l=()=>{window.removeEventListener("message",w,!1),s.close()},h=async t=>{await r((()=>(async t=>{const{state:e,code:o}=t;return await a({path:"wordproof/v1/oauth/authenticate",method:"POST",data:{state:e,code:o}})})(t)),(async t=>{const e={type:"wordproof:sdk:access-token",source_id:t.source_id};return s.postMessage(e,c("origin")),!0}),(async()=>!1))},y=async t=>{await r((()=>(async t=>{const{settings:e}=t;return await a({path:"wordproof/v1/settings",method:"POST",data:{settings:e}})})(t)),(async()=>{const o=t.settings;return o.selectedPostTypes&&e(o.selectedPostTypes),!0}),(async()=>!1))};window.addEventListener("wordproof:open_authentication",(t=>{t.preventDefault(),p(o,"WordProof_Authentication")}),!1),window.addEventListener("wordproof:open_settings",(t=>{t.preventDefault(),p(n,"WordProof_Settings")}),!1)})(),window.addEventListener("DOMContentLoaded",(e=>{O=document.querySelector("#_wordproof_timestamp"),E=O.checked,O&&(P=document.querySelector("#wordproof-action-link"),P&&v((0,t.createElement)(_,null),P),T(S()),m((()=>{T(S())})),O.addEventListener("change",(t=>{!b("wordproof").getIsAuthenticated()&&O.checked&&p()})))}));const k=c("current_post_type");let O=null,E=null,P=null;function T(t){t.includes(k)?(O.disabled=!0,O.checked=!0):(O.disabled=!1,O.checked=E)}function S(){return b("wordproof").getSelectedPostTypes()}}()}();